﻿<%@ Control Language="C#" AutoEventWireup="true" Codebehind="UserManagement.ascx.cs"
    Inherits="Portal.Administrator.Users.UserManagement" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>
<table border="0" cellpadding="0" cellspacing="1" class="content" width="100%">
    <tr>
        <td class="header1" align="left">
            <asp:Label ID="lblCommandName" runat="server"></asp:Label>
        </td>
    </tr>    
    <tr>
        <td class="header2" align="left" valign="top">
            <strong>Tìm:</strong>
            <asp:TextBox ID="txtKeyword" runat="server" Width="231px"></asp:TextBox>
            <strong>Theo:</strong>
            <asp:DropDownList ID="dropSearchBy" runat="server" Width="188px">
                <asp:ListItem Text="All" Value=""></asp:ListItem>
                <asp:ListItem Text="Username" Value="Username"></asp:ListItem>
                <asp:ListItem Text="Email" Value="Email"></asp:ListItem>
                <asp:ListItem Text="Fullname" Value="DisplayName"></asp:ListItem>
                <asp:ListItem Text="Group" Value="RoleDescription"></asp:ListItem>                
            </asp:DropDownList>
            <asp:Button ID="btnSearch" runat="server" CssClass="pbutton" Text="Tìm kiếm" OnClick="btnSearch_Click" /></td>
    </tr>
    <tr>
        <td class="postheader" align="left" valign="top">
            <asp:Repeater ID="rptLetters" runat="server" OnItemCommand="rptLetters_ItemCommand">
                <HeaderTemplate>
                    <table border="0" cellpadding="0" cellspacing="1" class="content" width="100%">
                    <tr>
                </HeaderTemplate>
                <ItemTemplate>
                        <td class="post" align="center">
                            <asp:LinkButton ID="lnkLetter" runat="server" CommandName="Alpha"></asp:LinkButton></td>
                </ItemTemplate>
                <FooterTemplate>
                    </tr>
                    </table>
                </FooterTemplate>
            </asp:Repeater>
        </td>
    </tr>
    <tr>
        <td class="postheader" align="left" valign="top">
            <asp:UpdatePanel ID="upanelGridUserManagemt" runat="server" UpdateMode="Conditional"
                RenderMode="Inline">
                <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="rptLetters" EventName="ItemCommand" />
                    <asp:AsyncPostBackTrigger ControlID="dtgUsers" EventName="ItemCommand" />
                    <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
                    <asp:AsyncPostBackTrigger ControlID="btnDeleteSelected" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <table class="content" cellspacing="1" cellpadding="0" width="100%">
                    <tr>
                        <td class="header2" align="left" width="25">
                            <asp:CheckBox runat="server" ID="chkAll" onclick="Check(this,'dtgUsers');highlightChkBxRow(this);" /></td>
                        <td class="header2" align="center">
                            Tên truy cập</td>
                        <td class="header2" align="center">
                            Email</td>
                        <td class="header2" align="center">
                            Tên</td>
                        <td class="header2" align="center">
                            Nhóm</td>
                        <td class="header2" align="center" width="140">
                            Thao tác</td>
                    </tr>
                    <asp:Repeater ID="dtgUsers" runat="server" OnItemCommand="dtgUsers_ItemCommand">
                    <ItemTemplate>
                        <tr>
                            <td class="post" align="left">
                                <asp:CheckBox runat="server" ID="DeleteThis" onclick="javascript: highlightChkBxRow(this);" /><asp:HiddenField ID="lblKey" runat="server" Value='<%# Eval("UserID") %>'></asp:HiddenField>
                            </td>
                            <td class="post" align="left">
                                <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>'></asp:Label>
                            </td>
                            <td class="post" align="left">
                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                            </td>
                            <td class="post" align="left">
                                <asp:Label ID="lblDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Label>
                            </td>
                            <td class="post" align="left">
                                <asp:Label ID="lblRoleDescription" runat="server" Text='<%# Eval("RoleDescription") %>'></asp:Label>
                            </td>
                            <td class="post" align="left">
                                <ImageButton:Update ID="btnImgManageProfile" ImageUrl="~/Administrator/Resource/Images/GridView/edit.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="manageprofile" ToolTip="Sửa" />
                                    &nbsp;
                                <ImageButton:Update ID="btnImgManagePassword" ImageUrl="~/Administrator/Resource/Images/GridView/password.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="managepassword" ToolTip="Mật khẩu" />
                                    &nbsp;                                
                                <ImageButton:Delete ID="btnImgDeleteUser" ImageUrl="~/Administrator/Resource/Images/GridView/delete.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="deleteuser" ToolTip="Xóa" />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <AlternatingItemTemplate>
                        <tr>
                            <td class="postheader" align="left">
                                <asp:CheckBox runat="server" ID="DeleteThis" onclick="javascript: highlightChkBxRow(this);" /><asp:HiddenField ID="lblKey" runat="server" Value='<%# Eval("UserID") %>'></asp:HiddenField>
                            </td>
                            <td class="postheader" align="left">
                                <asp:Label ID="lblUsername" runat="server" Text='<%# Eval("Username") %>'></asp:Label>
                            </td>
                            <td class="postheader" align="left">
                                <asp:Label ID="lblEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Label>
                            </td>
                            <td class="postheader" align="left">
                                <asp:Label ID="lblDisplayName" runat="server" Text='<%# Eval("DisplayName") %>'></asp:Label>
                            </td>
                            <td class="postheader" align="left">
                                <asp:Label ID="lblRoleDescription" runat="server" Text='<%# Eval("RoleDescription") %>'></asp:Label>
                            </td>
                            <td class="postheader" align="left">
                                <ImageButton:Update ID="btnImgManageProfile" ImageUrl="~/Administrator/Resource/Images/GridView/edit.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="manageprofile" ToolTip="Sửa" />
                                    &nbsp;
                                <ImageButton:Update ID="btnImgManagePassword" ImageUrl="~/Administrator/Resource/Images/GridView/password.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="managepassword" ToolTip="Mật khẩu" />
                                    &nbsp;                                
                                <ImageButton:Delete ID="btnImgDeleteUser" ImageUrl="~/Administrator/Resource/Images/GridView/delete.png" runat="server" CommandArgument='<%# Eval("UserID") %>' CommandName="deleteuser" ToolTip="Xóa" />
                            </td>
                        </tr>
                    </AlternatingItemTemplate>
                    </asp:Repeater>
                        <tr>
                            <td class="footer1" colspan="6">
                                <Button:Delete ID="btnDeleteSelected" runat="server" CssClass="pbutton" OnClientClick="return confirmMsg(this.form)" Text="Delete" OnClick="btnDeleteSelected_Click" />
                                &nbsp;
                                <Button:Create ID="btnAddUser" runat="server" CssClass="pbutton" OnClick="btnAddUser_Click" Text="Tạo người dùng mới" />
                                &nbsp;
                                <Button:View ID="btnPermission" runat="server" CssClass="pbutton" Text="Phân quyền" OnClick="btnPermission_Click" />
                                &nbsp;
                                <asp:Label ID="lblUpdateStatus" runat="server"></asp:Label>
                            </td>
                        </tr>
                    </table>                    
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>    
</table>
